//
//  CRSessionPrivateProtocol.h
//  CRKit
//
//  Created by chris on 2016/11/7.
//  Copyright © 2016年 NetEase. All rights reserved.
//

#ifndef CRSessionPrivateProtocol_h
#define CRSessionPrivateProtocol_h

@class CRMessage;
@class CRMessageModel;

@interface CRSessionMessageOperateResult : NSObject

@property (nonatomic,copy) NSArray *indexpaths;

@property (nonatomic,copy) NSArray *messageModels;

@end

@protocol CRSessionDataSource <NSObject>

- (NSArray *)items;

- (CRSessionMessageOperateResult *)addMessageModels:(NSArray *)models;

- (CRSessionMessageOperateResult *)insertMessageModels:(NSArray *)models;

- (CRSessionMessageOperateResult *)deleteMessageModel:(CRMessageModel *)model;

- (CRSessionMessageOperateResult *)updateMessageModel:(CRMessageModel *)model;

- (CRMessageModel *)findModel:(CRMessage *)message;

- (NSInteger)indexAtModelArray:(CRMessageModel *)model;

- (NSArray *)deleteModels:(NSRange)range;

- (void)resetMessages:(void(^)(NSError *error))handler;

- (void)enhancedResetMessages:(void(^)(NSError *error, NSArray *))handler;

- (void)loadHistoryMessagesWithComplete:(void(^)(NSInteger index, NSArray *messages , NSError *error))handler;

- (void)loadNewMessagesWithComplete:(void(^)(NSInteger index, NSArray *messages , NSError *error))handler;

- (void)checkAttachmentState:(NSArray *)messages;

- (void)cleanCache;

- (void)refreshMessageModelShowSelect:(BOOL)isShow;

- (void)loadMessagePins:(void (^)(NSError *))handler;

// 展示message之前做额外配置
- (void)willDisplayMessageModel:(CRMessageModel *)model;

- (void)addPinForMessage:(CRMessage *)message callback:(void (^)(NSError *))handler;

- (void)removePinForMessage:(CRMessage *)message callback:(void (^)(NSError *))handler;

@end


@protocol CRSessionLayoutDelegate <NSObject>

- (void)onRefresh;

@end

@protocol CRSessionLayout <NSObject>

- (void)update:(NSIndexPath *)indexPath;

- (void)insert:(NSArray *)indexPaths aCRated:(BOOL)aCRated;

- (void)remove:(NSArray *)indexPaths;

- (BOOL)canInsertChatroomMessages;

- (void)calculateContent:(CRMessageModel *)model;

- (void)reloadTable;

- (void)resetLayout;

- (void)changeLayout:(CGFloat)inputViewHeight;

- (void)setDelegate:(id<CRSessionLayoutDelegate>)delegate;

- (void)layoutAfterRefresh;

- (void)adjustOffset:(NSInteger)row;

- (void)dismissReplyContent;

- (NSInteger)numberOfRows;

@end


#endif /* CRSessionPrivateProtocol_h */
